home *** CD-ROM | disk | FTP | other *** search
/ Risc World 5 / Risc World 5.iso / SOFTWARE / Issue3 / Games / xrick / !xrick / src / c / scr_gameov < prev    next >
Text File  |  2004-06-24  |  2KB  |  102 lines

  1. /*
  2.  * xrick/src/scr_gameover.c
  3.  *
  4.  * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). All rights reserved.
  5.  *
  6.  * The use and distribution terms for this software are contained in the file
  7.  * named README, which can be found in the root of this distribution. By
  8.  * using this software in any fashion, you are agreeing to be bound by the
  9.  * terms of this license.
  10.  *
  11.  * You must not remove this notice, or any other, from this software.
  12.  */
  13.  
  14. #include "stddef.h" /* NULL */
  15.  
  16. #include "system.h"
  17. #include "game.h"
  18. #include "screens.h"
  19.  
  20. #include "draw.h"
  21. #include "control.h"
  22.  
  23. /*
  24.  * Display the game over screen
  25.  *
  26.  * return: SCREEN_RUNNING, SCREEN_DONE, SCREEN_EXIT
  27.  */
  28. U8
  29. screen_gameover(void)
  30. {
  31.     static U8 seq = 0;
  32.     static U8 period = 0;
  33. #ifdef GFXST
  34.     static U32 tm = 0;
  35. #endif
  36. #ifdef ENABLE_SOUND
  37.     static sound_t *snd;
  38.     static U8 chan;
  39. #endif
  40.  
  41.     if (seq == 0) {
  42.         draw_tilesBank = 0;
  43.         seq = 1;
  44.         period = game_period; /* save period, */
  45.         game_period = 50;     /* and use our own */
  46. #ifdef ENABLE_SOUND
  47.         game_setmusic("sounds/gameover.wav", 1);
  48. #endif
  49.     }
  50.  
  51.     switch (seq) {
  52.     case 1:  /* display banner */
  53. #ifdef GFXST
  54.         sysvid_clear();
  55.         tm = sys_gettime();
  56. #endif
  57.         draw_tllst = screen_gameovertxt;
  58.         draw_setfb(120, 80);
  59. #ifdef GFXPC
  60.         draw_filter = 0xAAAA;
  61. #endif
  62.         draw_tilesList();
  63.  
  64.         game_rects = &draw_SCREENRECT;
  65.         seq = 2;
  66.         break;
  67.  
  68.     case 2:  /* wait for key pressed */
  69.         if (control_status & CONTROL_FIRE)
  70.             seq = 3;
  71. #ifdef GFXST
  72.         else if (sys_gettime() - tm > SCREEN_TIMEOUT)
  73.             seq = 4;
  74. #endif
  75.         else
  76.             sys_sleep(50);
  77.         break;
  78.  
  79.     case 3:  /* wait for key released */
  80.         if (!(control_status & CONTROL_FIRE))
  81.             seq = 4;
  82.         else
  83.             sys_sleep(50);
  84.         break;
  85.     }
  86.  
  87.     if (control_status & CONTROL_EXIT)  /* check for exit request */
  88.         return SCREEN_EXIT;
  89.  
  90.     if (seq == 4) {  /* we're done */
  91.         sysvid_clear();
  92.         seq = 0;
  93.         game_period = period;
  94.         return SCREEN_DONE;
  95.     }
  96.  
  97.   return SCREEN_RUNNING;
  98. }
  99.  
  100. /* eof */
  101.  
  102.